﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="UI.system.login" %>
<%@ Import Namespace="Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>金域玻片仓储管理系统</title>
    <script src="js/jquery.min.js"></script>
    <script src="layui/layui.js" type="text/javascript"></script>
    <script src="js/common.js"></script>
    <script src="js/md5.js"></script>
    <link href="css/login.css" rel="stylesheet" type="text/css" />
</head>
<body onkeyup='CRM.Enter("#login")'>
<!-- 顶部栏-->
<div class="topbar">
  <div class="topcon w">
    <div class="logo"> <a href="javascript:void(0)"> <img src="img/logo.jpg" /></a></div>
    <%--<div class="enter-web"> <a href="http://www.kingmed.com.cn/" target="_blank">进入官网</a></div>--%>
  </div>
</div>
<!-- 内容-->
<div class="content w">
  <div class="log_con">
    <div class="log_l"><img src="img/login_bg.png" /></div>
    <div class="log_r">
      <div class="tit"> 管理员登录 </div>
      <form class="layui-form" method="post">
        <input id="hdtokenid" type="hidden" />
        <div class="write_uesr">
          <div class="inputline"> <span class="bg_name"></span>
            <input type="text" class="username" name="username" id="username" value="" placeholder="请输入用户名" onkeyup='CRM.Enter("#login")'>
            <label class="tishi"> </label>
          </div>
          <div class="inputline"> <span class="bg_pass"></span>
            <input type="password" class="pwd fr" name="userpwd" id="userpwd" value="" placeholder="请输入密码" onkeyup='CRM.Enter("#login")'>
            <label class="tishi"> </label>
          </div>
          <div class="groupline">
            <button id="login" type="button" class="btn" lay-submit lay-filter="login"> 登 录</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
				form = layui.form;
        form.verify({
            username: function (value) {
                if (value == "") {
                    return '用户名不能为空';
                }
            },
            userpwd: function (value) {
                if (value == "") {
                    return '密码不能为空';
                }
            }
        });
        form.on('submit(login)', function (data) {
            var field = data.field;
            var data = {};
            data.act = "Login";
            data.username = field.username;
            data.userpwd = field.userpwd;
            data.rememberme = $("#rememberme").prop("checked");
            data.sign = GetSign(data.act);
            var index = LayerBox.Loading();
            Ajax.Post("/tools/Admin.ashx", data, function (r) {
                LayerBox.Close.ByIndex(index);
                var json = $.parseJSON(r);
                if (json.state) {
                    var data = {};
                    data.act = "Save_Journal";
                    data.sign = GetSign(data.act);
                    Ajax.Post("/tools/Admin.ashx", data, function (o) {
                        var jsons = $.parseJSON(o);
                        if (jsons.state) {
                            LayerBox.Success(json.msg, 500, function () {
                                window.location.href = "index.aspx";
                            });
                        } else {
                            LayerBox.Error("登录错误，请重新登录");
                        }
                    });
                }
                else {
                    LayerBox.Error(json.msg);
                }
            });
        });

    });

    $(document).ready(function () {
        setTimeout(function () {
            $("#username").val($.cookies.get("admin_username"));
            $("#userpwd").val($.cookies.get("admin_userpwd"));
        }, 500);
    });
		</script>

</body>
</html>
